package com.zucc.core.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zucc.common.utils.GetEqu;
import com.zucc.core.dao.EquipmentDao;
import com.zucc.core.po.Equipment;
import com.zucc.core.service.EquipmentService;


@Service("EquipmentService")
@Transactional
public class EquipmentServiceImp implements EquipmentService {
	
	@Autowired
	private EquipmentDao equipmentDao;
	
	@Override
	public List<Equipment> selectEquipById(String equList) {
		if(equList!=null&&!equList.equals("")) {
			List<String> equIds=((new GetEqu()).getEquId(equList));
		List<Equipment> equipments=new ArrayList<Equipment>();
		for(String euqid:equIds) {
			Equipment equipment=new Equipment();
			equipment=equipmentDao.selectEquById(euqid);
			equipments.add(equipment);
			}
		return equipments;
		}else return null;
	}

	@Override
	public List<Equipment> selectEquip() {
		
		return equipmentDao.selectEqu();
	}

}
